# Maintainer: Jelle van der Waa <jelle@archlinux.org>
# Contributor: Anthony25 <Anthony Ruhier>
# Contributor Jeremy "Ichimonji10" Audet <ichimonji10 at gmail dot com>

_name=django-debug-toolbar
pkgname=python-django-debug-toolbar
pkgver=4.0.0
pkgrel=1
pkgdesc='A configurable set of panels that display various debug information about the current request/response.'
arch=(any)
url='https://github.com/jazzband/django-debug-toolbar'
license=(BSD)
makedepends=(python-build python-installer python-wheel python-hatchling)
checkdepends=(python-jinja python-html5lib)
depends=(python-django python-sqlparse)
source=(${pkgname}-${pkgver}.tar.gz::https://github.com/jazzband/${_name}/archive/${pkgver}.tar.gz
        drop-fautly-classifiers.patch)
sha256sums=('3b9c02b21284a0c34562f7be9829dac06005cccf9e41cd8cadf9763b1f3f5908'
            '0414e36d2129794effc8a1f93a920f447e2bcfb333aa01e5898d279f1424a561')

prepare() {
  cd "${_name}-${pkgver}"
  patch -Np1 -i ${srcdir}/drop-fautly-classifiers.patch
}

build() {
  cd "${_name}-${pkgver}"
  python -m build --wheel --no-isolation
}

check() {
  cd "${_name}-${pkgver}"
  # Doesn't work due to warnings
  #PYTHONPATH=. DB_BACKEND=sqlite3 DB_NAME=":memory:" DJANGO_SETTINGS_MODULE=tests.settings python -m django test tests
}

package() {
  cd "${_name}-${pkgver}"
  python -m installer --destdir="$pkgdir" dist/*.whl

  install -Dm 644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}

# vim:set ts=2 sw=2 et:
